/**
 @文件名： userApi
 @来源：YongPing.Wang|2023/11/20 15:07
 @描述：
 **/

import { getLogin, postLogin } from '@/config/apiConfig/https.ts'
import { type IUserDO } from '@/store/userInfo.ts'
import { type IApi } from '@/api/types.ts'

export interface ILoginApi {
  url: string
  token: string
  userDO: IUserDO
}
export interface IUserLoginPam {
  account: string
  pwd: string
  rememberMe: boolean
}

// 登录
export async function loginApi(data: IUserLoginPam): Promise<IApi<ILoginApi>> {
  return await postLogin([`/user/login`, data], false)
}
// 退出登录
export async function logoutApi(): Promise<IApi<string>> {
  return await getLogin([`/user/logout`])
}
// 修改密码
export async function changePwdApi(data: any): Promise<any> {
  return await postLogin([`/user/change/pwd`, data])
}
